import allure
from selenium.webdriver.common.by import By

from bazhuayun.page.base_octopus_cloud import BaseOctopusCloud
from bazhuayun.utils.log_utils import logger


class OrdersPage(BaseOctopusCloud):
    _ORDER_MANAGEMENT = By.XPATH, '//*[text()="订单管理"]'
    _ORDER_INPUT = By.XPATH, '//*[text()="订单录入"]'
    _HAND_CREATE = By.XPATH, '//*[text()="手动创建"]'

    @allure.step("进入订单录入页面")
    def orders_page(self):
        # 点击订单管理
        self.find_ele(*self._ORDER_MANAGEMENT).click()
        # 点击订单录入
        self.find_ele(*self._ORDER_INPUT).click()
        # 点击手动创建
        self.find_ele(*self._HAND_CREATE).click()
        logger.info("进入订单录入页面")

        from bazhuayun.page.orders_input import OrdersInput
        return OrdersInput(self.driver)









